printing: Don't crash when printer-state-message not provided
authorMarek Kasik <mkasik@redhat.com>
Mon, 6 May 2013 11:43:18 +0000 (13:43 +0200)
committerMarek Kasik <mkasik@redhat.com>
Thu, 9 May 2013 13:13:59 +0000 (15:13 +0200)
Check whether "printer-state-message" was returned before its
usage.

https://bugzilla.gnome.org/show_bug.cgi?id=699750

modules/printbackends/cups/gtkprintbackendcups.c

index 34c6eac3e53f622033dda5ba5107b0490a01a7af..5656615606fd687485e79def3e45ed90f118e71b 100644 (file)
@@ -2320,7 +2320,7 @@ set_info_state_message (PrinterSetupInfo *info)
 
       if (info->reason_level >= GTK_PRINTER_STATE_LEVEL_WARNING)
         {
-          if (strlen (info->state_msg) == 0)
+          if (info->state_msg == NULL || info->state_msg[0] == '\0')
             {
               g_free (info->state_msg);
               info->state_msg = reason_msg_desc;